<% content_for :content do %>

  <!-- widget grid -->
  <section id="widget-grid" class="">
  
    <!-- row -->
    <div class="row">
  
      <!-- NEW WIDGET START -->
      <article class="col-xs-12 col-sm-12 col-md-12 col-lg-12">
  
        <!-- Widget ID (each widget will need unique ID)-->
        <div class="jarviswidget jarviswidget-color-darken" id="wid-id-1" data-widget-editbutton="false" data-widget-colorbutton="false" data-widget-deletebutton="false">
          <!-- widget options:
          usage: <div class="jarviswidget" id="wid-id-0" data-widget-editbutton="false">

          data-widget-colorbutton="false"
          data-widget-editbutton="false"
          data-widget-togglebutton="false"
          data-widget-deletebutton="false"
          data-widget-fullscreenbutton="false"
          data-widget-custombutton="false"
          data-widget-collapsed="true"
          data-widget-sortable="false"

          -->
          <header>
            <span class="widget-icon"> <i class="fa fa-table"></i> </span>
            <h2>广告规则</h2>
          </header>

          <!-- widget div-->
          <div>

            <!-- widget edit box -->
            <div class="jarviswidget-editbox">
              <!-- This area used as dropdown edit box -->
            </div>
            <!-- end widget edit box -->

            <!-- widget content -->
            <div class="widget-body no-padding">

              <table class="table table-bordered table-striped">
                <thead>
                  <tr>
                    <th>位置</th>
                    <th>文件名</th>
                    <th>大小（KB）</th>
                    <th>尺寸（高*宽）</th>
                    <th>操作</th>
                  </tr>
                </thead>
                <tbody>
                <% @advertise_group.advertises.each do |item| %>
                  <tr id='advertise-<%= item.id %>'>
                    <td><%= item.position %></td>
                    <td><%= item.cover_identifier %> </td>
                    <td><%= nice_bytes(item.file_size) if item.file_size%></td>
                    <td><%= item.cover_dimensions %></td>
                    <td>
                      <%= form_for item,:url => admin_recruitment_path(item), :multipart => true , :defaults => { :input_html => { :class => "form-control" } }, html: { class: "form-inline" } do |f| %>
                        <div class="form-group">
                          <%= f.file_field :cover, class: "btn btn-default form-control" %>
                        </div>
                        <%= f.check_box :remove_cover %> 删除
                        <%= f.submit value: '修改图片', class: "btn btn-primary btn-sm" %>
                        <% if item.cover? %>
                        <a class="btn btn-default btn-sm" href="<%= pull_image_images_path(class_name: item.class.name,id: item.id,attr: :cover) %>" data-title="<%= item.position %>" data-footer="<%= item.cover_identifier %>" data-toggle="lightbox" data-type="image">预览图片</a>
                        <% end %>
                      <% end %>
                    </td>
                  </tr>
                <% end %>
                </tbody>
              </table>


            </div>
            <!-- end widget content -->

          </div>
          <!-- end widget div -->

        </div>
        <!-- end widget -->
        
      </article>
      <!-- WIDGET END -->

      <article class="col-xs-12 col-sm-12 col-md-12 col-lg-12">
        </div>
          <button type="submit" class="btn btn-default" onclick="history.back();">Back</button>
        </div>
      </article>

    </div>
  
    <!-- end row -->

  </section>
  <!-- end widget grid -->

<% end %>